import { baseUrl, testUrl } from './config'
let fetch = (api, data = {}) => {
  return new Promise((resolve, reject) => {
    wx.request({
      url: `${baseUrl}/api.aspx?action=${api}`,
      data,
      success: res => {
        if (res.statusCode == 200) {
          resolve(res)
        } else {
          reject('请求错误，请检查后台代码')
        }
      },
      fail: err => {
        reject(err)
      }
    })
  })
}
export {
  fetch
}